package com.conversationboard.model;

import java.sql.SQLException;
import java.util.Date;

import com.conversationboard.logger.LogMessageType;
import com.conversationboard.logger.Logger;

/**
 * Hold messages to indicate when batch jobs are running.
 * 
 * Theoretically, access to 'message' should be synchronized, but chances of any
 * problems here are astronomically unlikely; impact is also little.
 * 
 * @author Keith Watson
 * 
 */

public class BatchMessage {

    private static String message = null;


    public static String getMessage() {
        return message;
    }
    
    public static void setMessage(String batchMessage, boolean log) throws SQLException {
    	
    	if (log) {
    		Logger.log(new Date(), batchMessage, null, LogMessageType.SYSTEM);
    	}
    	
        message = batchMessage;
    }


    public static void clearMessage() {
        message = null;
    }

}
